<script src="<?php echo $includes_dir;?>lib/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="<?php echo $includes_dir;?>js/jquery-ui.js" type="text/javascript"></script>
<script src="<?php echo $includes_dir;?>lib/bootstrap/js/bootstrap.js"></script>
<script src="<?php echo $includes_dir;?>lib/bootstrap-confirm.js"></script>
<script src="<?php echo $includes_dir;?>lib/bootbox.min.js"></script>
<script src="<?php echo $includes_dir;?>js/jquery.blockUI.js?v=1.0"></script>

<script type="text/javascript">
    $("[rel=tooltip]").tooltip();
    $(function() {
        $('.demo-cancel-click').click(function(){return false;});
    });

// 1.判断select选项中 是否存在Value="paraValue"的Item        
function jsSelectIsExitItem(objSelect, objItemValue) {        
    var isExit = false;        
    for (var i = 0; i < objSelect.options.length; i++) {        
        if (objSelect.options[i].value == objItemValue) {        
            isExit = true;        
            break;        
        }        
    }        
    return isExit;        
}         
   
// 2.向select选项中 加入一个Item        
function jsAddItemToSelect(objSelect, objItemText, objItemValue) {        
    //判断是否存在        
    if (jsSelectIsExitItem(objSelect, objItemValue)) {        
        //alert("该Item的Value值已经存在");        
    } else {        
        var varItem = new Option(objItemText, objItemValue);      
        objSelect.options.add(varItem);     
        //alert("成功加入");     
    }        
}        
   
// 3.从select选项中 删除一个Item        
function jsRemoveItemFromSelect(objSelect, objItemValue) {        
    //判断是否存在        
    if (jsSelectIsExitItem(objSelect, objItemValue)) {        
        for (var i = 0; i < objSelect.options.length; i++) {        
            if (objSelect.options[i].value == objItemValue) {        
                objSelect.options.remove(i);        
                break;        
            }        
        }        
        //alert("成功删除");        
    } else {        
        //alert("该select中 不存在该项");        
    }        
} 	

</script>

